# Contributor: David Huffman <storedbox@outlook.com>
# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=glog
pkgver=0.7.1
pkgrel=1
pkgdesc="C++ implementation of the Google logging module"
url="https://github.com/google/glog"
arch="all"
license="BSD-3-Clause"
depends_dev="gflags-dev libunwind-dev"
makedepends="$depends_dev cmake gtest-dev libucontext-dev samurai"
subpackages="$pkgname-dev"
source="https://github.com/google/glog/archive/v$pkgver/glog-$pkgver.tar.gz
	ucontext-ppc64le.patch"
options="!check" # 2 test fails https://github.com/google/glog/issues/813

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DWITH_GFLAGS=ON \
		-DWITH_THREADS=ON \
		-DWITH_TLS=ON \
		-DWITH_PKGCONFIG=ON \
		-DPRINT_UNSYMBOLIZED_STACK_TRACES=OFF
	cmake --build build
}

check() {
	cd build
	# Test is failing: https://github.com/google/glog/issues/813
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E symbolize
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
2dabac87d44e4fe58beceb31b22be732b47df84c22f1af8c0e7d0f262de939889de1f16025c1256539f2833ef3393bc92034e983aa2886752bb8705801a68630  glog-0.7.1.tar.gz
fb76187c18e92af8d289475b64132ee9ee98fce4343a2389c99c8a3cf990888e515740ef27a7adf70e64705c8d40f001c169e48a377f42ee16e93ebb74587e87  ucontext-ppc64le.patch
"
